import requests
from bs4 import BeautifulSoup
import os
import time
#1.确定url
#https://www.biqiuge.com/book/4772/2940354.html
#2.请求url
def getMyBook(baseUrl,pageUrl):
 response = requests.get(baseUrl+pageUrl)
 print(response.content)
 #3.得到响应的内容 处理
 # soup = BeautifulSoup(response.content,'lxml') #将响应对象的内容放入soup对象备用
 # txtTitle = soup.find('h1').get_text()
 # print(txtTitle)
 # txtContent = soup.find('div',id='content',class_='showtxt').text.replace(' ','\n').replace('app2();read2();','\n')
 # #print(txtContent)
 # #获取下一章的链接
 # nextPageUrl = soup.find('a',text='下一章')['href']
 # print(nextPageUrl)
 # #4.内容保存
 # if not os.path.exists(r"w:\\小说\\first"):
 #    os.makedirs(r"w:\\小说\\first")
 # f = open(r"w:\\小说\\first\\"+ txtTitle + ".txt",'a+',encoding='utf-8')
 # f.write(txtTitle+'\n')
 # f.write(txtContent+'\n')
 # f.close()
 # if not nextUrl is None:
 #    time.sleep(2)
 #    getMyBook(baseUrl,nextPageUrl)
getMyBook("https://e6e28f7353c0746f565.bi28.cc/html/45333/","6015.html")